package com.uui.service.menu;

import java.util.HashMap;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.uui.bean.FirstMenu;
import com.uui.mapper.menu.MenuMapper;
import com.uui.util.ResultMap;

@Service
@Transactional
public class MenuServiceImp implements MenuService {
	Logger logger = Logger.getLogger(MenuServiceImp.class);
	@Autowired
	MenuMapper menuMapper ;
	
	@Override
	public List<ResultMap<String, Object>> queryMainMenu(HashMap<String, Object> whereMap) {
		List<ResultMap<String, Object>> products = menuMapper.queryMainMenu(whereMap);
		return products;
	}

	@Override
	public List<ResultMap<String, Object>> queryMenu(HashMap<String, Object> whereMap) {
		List<ResultMap<String, Object>> menus = menuMapper.queryMenu(whereMap);
		return menus;
	}

	@Override
	public void deleteMainMenu(String id) {
		menuMapper.deleteMainMenu(id);
	}

	@Override
	public void updateMainMenu(FirstMenu menu) {
		
	}

	@Override
	public List<ResultMap<String, Object>> queryAuthority() throws Exception {
		try {
			return menuMapper.queryAuthority();
		} catch (Exception e) {
			throw new Exception("获取权限列表失败");
		}
		
	}

	@Override
	public void addMainMenu(FirstMenu menu) {
		menuMapper.addMainMenu(menu);
	}
}
